package com.wwy.monitor.scheduler;

import com.wwy.monitor.model.enumeration.MonitorTypeEnum;
import com.wwy.monitor.service.MonitorTaskService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * (ç±»ååè½è¯´ææè¿°ï¼æå¡åé¨æ°æ®åºä¸è´çæ§ä»»å¡
 *
 * @author gezhen
 * @version 1.0
 * @since JDK1.8
 */
@Component
public class DBdataTask {
    private static final Logger logger = LoggerFactory.getLogger("monitorTaskLogger");
    @Autowired
    private MonitorTaskService monitorTaskService;

    /**
     * æ°æ®åºä¸è´çæ§å®æ¶ä»»å¡
     */
    @Scheduled(fixedDelay = 1000 * 60)
    public void runDBdataTask() {
        logger.info("DBdataTask task start");
        try {
            monitorTaskService.dealMonitorTaskAndSendMsg(MonitorTypeEnum.DATABASE.getValue());
        } catch (Exception e) {
            e.printStackTrace();
        }
        logger.info("DBdataTask task end");
    }
}